package com.fulin.leetcode;

/**
 * 判断两棵树是否相同
 *
 * @Author fulin
 * @Date 2022/9/20 10:10
 **/
public class Num100 {
    public boolean isSameTree(TreeNode p, TreeNode q) {
        if(p == null && q == null){
            return true;
        }else if(p == null || q == null ){
            return false;
        }else if(p.val != q.val){
            return false;
        }else{
            return isSameTree(p.left,q.left) && isSameTree(p.right,q.right);
        }
    }
}
